<template>
  <div class="flex flex-col h-full">
    <SearchContainer @search="getData" @reset="() => formRef.resetFields()">
      <a-form ref="formRef" class="form-style-flex" :model="formState" :label-col="{ style: { width: '70px' } }">
        <a-form-item name="dateRange" label="挂号日期" class="w-80 mr-5">
          <a-range-picker v-model:value="formState['dateRange']" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
        </a-form-item>
        <a-form-item name="pyjm" label="" class="w-80">
          <a-input v-model:value="formState.pyjm" placeholder="姓名/助记码/卡号/手机号/身份证号" allow-clear />
        </a-form-item>
      </a-form>
    </SearchContainer>
    <a-card class="mt-2 flex-1">
      <!-- <div class="flex justify-end mb-2">
        <BaseExport type="门诊" name="退费检索" code="001217" is-show-time :search-params="formState">导出</BaseExport>
      </div> -->
      <BaseTable fill :loading="loading" column-code="001217" :data-source="tableData" bordered :pagination="pagination">
        <template #bodyCell="{ column, index }">
          <template v-if="column.dataIndex === 'xh'">
            {{ index + 1 }}
          </template>
        </template>
      </BaseTable>
    </a-card>
  </div>
</template>

<script setup>
import { ref, onMounted, reactive } from 'vue'
import dayjs from 'dayjs'
import SearchContainer from '@/components/SearchContainer'
// import { post } from '@/utils/request'

const formRef = ref(null)
const formState = reactive({
  dateRange: [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
  pyjm: '',
  pjhm: '',
  sftfbz: '3'
})
const { loading, tableData, pagination, getData } = useTable({
  url: '/outp/oupCharge/getTollRetrievalListNotCharged',
  formatParams: () => {
    return {
      stdate: formState.dateRange?.[0],
      eddate: formState.dateRange?.[1],
      pyjm: formState.pyjm
    }
  }
})
// const onPrint = async (row) => {
//   if (row.jslxbz === 1) {
//     //挂号收费
//     const { code, msg, data } = await post('/outp/outPrint/getRegistrationBillPrint', { jzbh: row.jzbh, pjhm: row.pjhm, sftfbs: '1' })
//     if (code !== 0) return message.error(msg)
//     window.openExe?.rpt(data) //调用winform打印
//   } else {
//     //门诊收费
//     const { code, msg, data } = await post('/outp/oupCharge/PrintMedicareCharges', { jzbh: row.jzbh, pjhm: row.pjhm, sftfbs: '1' })
//     if (code !== 0) return message.error(msg)
//     window.openExe?.rpt(data) //调用winform打印
//   }
// }

onMounted(() => {
  getData()
})
</script>
<style lang="less" scoped>
.ant-picker {
  width: 100%;
}
</style>
